import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
// import AutoImport from 'unplugin-auto-import/vite'
// import Components from 'unplugin-vue-components/vite'
// import ElementPlus from 'unplugin-element-plus/vite'
// import { ElementPlusResolver } from 'unplugin-vue-components/resolvers'
import path from 'path'
import { svgBuilder } from './src/plugins/svgBuilder'
import vueI18n from '@intlify/vite-plugin-vue-i18n'


// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    svgBuilder('./src/icons/svg/'),
    vueI18n({
      // if you want to use Vue I18n Legacy API, you need to set `compositionOnly: false`
      // compositionOnly: false,
      // you need to set i18n resource including paths !
      // include: path.resolve(__dirname, './path/to/src/locales/**')
    }),
    /**按需加载的插件，但是与主题设置冲突，所以暂时先不启用
      ViteComponents({
        customComponentResolvers: [AntDesignVueResolver()],
      }),
    */
      // AutoImport({
      //   resolvers: [ElementPlusResolver()],
      // }),
      // Components({
      //   resolvers: [ElementPlusResolver()],
      // }),
      // ElementPlus()
  ],
  resolve:{
    alias:{
      '@': path.join(__dirname,'src')
    },
  },
  css:{
    preprocessorOptions: {
      less: {
        modifyVars: {
          'primary-color': '#1890ff',
          'link-color': '#1890ff',
          'border-radius-base': '4px',
        },
        javascriptEnabled: true,
      },
    },
  },
  server: {
    proxy: {
        // 选项写法
        '/qms': {
            logLevel: 'debug',
            // target: 'http://localhost:5000', // 本地
            target: 'http://10.176.116.118:5000',
            //  rewrite: path => path.replace(/^\/api/, ''), // 重写传过来的path路径，比如 `/api/index/1?id=10&name=zs`（注意:path路径最前面有斜杠（/），因此，正则匹配的时候不要忘了是斜杠（/）开头的；选项的 key 也是斜杠（/）开头的）
            changeOrigin: true // true/false, Default: false - changes the origin of the host header to the target URL
        }
    }
}
})